home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / cups.preinst < prev    next >
Text File  |  2009-10-31  |  3KB  |  103 lines

  1. #! /bin/sh
  2. # preinst script for cups
  3. #
  4. # see: dh_installdeb(1)
  5.  
  6. set -e
  7.  
  8. # summary of how this script can be called:
  9. #        * <new-preinst> `install'
  10. #        * <new-preinst> `install' <old-version>
  11. #        * <new-preinst> `upgrade' <old-version>
  12. #        * <old-preinst> `abort-upgrade' <new-version>
  13.  
  14. mv_conffile() {
  15.   OLD="$1"
  16.   NEW="$2"
  17.   PKGNAME="cupsys"
  18.   if [ -e "$OLD" ]; then
  19.       md5sum=$(md5sum "$OLD" | sed -e 's/ .*//')
  20.       old_md5sum=$(dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e "\\' $OLD'{s/ obsolete$//;s/.* //p}")
  21.       if [ "$md5sum" = "$old_md5sum" ]; then
  22.           echo "Removing obsolete unchanged $OLD..." >&2
  23.           rm -f "$OLD"
  24.       else
  25.           echo "Moving customized $OLD to new location $NEW..." >&2
  26.           mv -f "$OLD" "$NEW"
  27.       fi
  28.   fi
  29. }
  30.  
  31. case "$1" in
  32.     install|upgrade)
  33.     if [ -e /var/lib/cups/ppd -a ! -L /var/lib/cups/ppd -a ! -e /etc/cups/ppd ]; then
  34.         echo -n "Moving printer definition files..."
  35.         mkdir -p /etc/cups/ppd || true
  36.         if [ `ls /var/lib/cups/ppd | wc -l` -ne "     0" ]; then
  37.         cp -a /var/lib/cups/ppd/* /etc/cups/ppd
  38.         fi
  39.         rm -rf /var/lib/cups/ppd
  40.         echo "done."
  41.     fi
  42.  
  43.     if [ -e /var/lib/cups/logs -a ! -L /var/lib/cups/logs ]; then
  44.         rmdir /var/lib/cups/logs || true
  45.     fi
  46.  
  47.     # Remove dangling pdftops.conf symlink, which is obsolete anyway
  48.     if [ -L /etc/cups/pdftops.conf -a ! -e /etc/cups/pdftops.conf ]; then
  49.         rm -f /etc/cups/pdftops.conf
  50.     fi
  51.  
  52.         # fix 'cupsys' -> 'root' file owner mode transition
  53.     if dpkg --compare-versions "$2" lt-nl '1.3.0-3'; then
  54.         if [ -d /var/run/cups ]; then
  55.         chown -R root /var/run/cups
  56.         fi
  57.             chown -R root /etc/cups /var/log/cups /var/cache/cups /var/spool/cups
  58.         fi
  59.  
  60.         # cupsys -> cups package/file rename
  61.     if dpkg --compare-versions "$2" le '1.3.7-7'; then
  62.             update-rc.d -f cupsys remove
  63.             mv_conffile /etc/default/cupsys /etc/default/cups
  64.             mv_conffile /etc/init.d/cupsys /etc/init.d/cups
  65.             mv_conffile /etc/pam.d/cupsys /etc/pam.d/cups
  66.             mv_conffile /etc/logrotate.d/cupsys /etc/logrotate.d/cups
  67.         fi
  68.  
  69.     # does not need d-bus configuration, only sends signals
  70.     if dpkg --compare-versions "$2" lt-nl '1.3.9-16'; then
  71.             rm -f /etc/dbus-1/system.d/cups.conf
  72.     fi
  73.  
  74.     # Obsolete symlinks, and they wreak havoc now
  75.     if dpkg --compare-versions "$2" lt-nl '1.4.0-6'; then
  76.         rm -f /usr/share/ppd/1-local-admin /usr/share/ppd/2-third-party
  77.     fi
  78.  
  79.     # blacklist was installed for some weeks (intra-squeeze and karmic),
  80.     # remove it again (now USB backend works with both)
  81.     if dpkg --compare-versions "$2" lt-nl '1.4.1-4'; then
  82.         rm -f /etc/modprobe.d/blacklist-cups.conf
  83.     fi
  84.     ;;
  85.  
  86.     abort-upgrade)
  87.     ;;
  88.  
  89.     *)
  90.         echo "preinst called with unknown argument \`$1'" >&2
  91.         exit 0
  92.     ;;
  93. esac
  94.  
  95. # dh_installdeb will replace this with shell code automatically
  96. # generated by other debhelper scripts.
  97.  
  98.  
  99.  
  100. exit 0
  101.  
  102.  
  103.